package edu.ensmp.ckEditor.control;

import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;


import edu.ensmp.ckEditor.ckModel.CKModel;
import edu.ensmp.ckEditor.gui.EditorFrame;
import edu.ensmp.ckEditor.util.UiConstants;

public class TextFocusListener implements FocusListener {
	private EditorFrame _editorFrame;	
	private CKModel _model;
	
	
	public TextFocusListener(CKModel model, EditorFrame editorFrame){
		this._model = model;
		this._editorFrame = editorFrame;
	}
	
	
	public void focusGained(FocusEvent e) {
		_editorFrame.getButtonPanel().setSelectedIndex(0);
		

		if (_editorFrame.getConceptPanel().getVisuViewer().isFocusOwner()) {
			_editorFrame.getConceptPanel().setLabelColor(UiConstants.FOCUSED_LABEL_COLOR);
			// conceptPanel.setBackground(Color.WHITE);
			// knowledgePanel.setBackground(Color.GRAY);
			// knowledgePanel.getVisuViewer().setBackground(Color.GRAY);
		}
		if (_editorFrame.getKnowledgePanel().getVisuViewer().isFocusOwner()) {
			_editorFrame.getKnowledgePanel().setLabelColor(UiConstants.FOCUSED_LABEL_COLOR);
			// knowledgePanel.setBackground(Color.WHITE);
			// conceptPanel.setBackground(Color.GRAY);
			// conceptPanel.getVisuViewer().setBackground(Color.GRAY);
		}

	
	}

	
	public void focusLost(FocusEvent e) {

		if (!_editorFrame.getConceptPanel().getVisuViewer().isFocusOwner()) {
			_editorFrame.getConceptPanel().setLabelColor(UiConstants.UNFOCUSED_LABEL_COLOR);
			// conceptPanel.setBackground(Color.WHITE);
			// conceptPanel.getVisuViewer().setBackground(Color.WHITE);
		}
		if (!_editorFrame.getKnowledgePanel().getVisuViewer().isFocusOwner()) {
			_editorFrame.getKnowledgePanel().setLabelColor(UiConstants.UNFOCUSED_LABEL_COLOR);
			// knowledgePanel.setBackground(Color.WHITE);
			// knowledgePanel.getVisuViewer().setBackground(Color.WHITE);
		}
	
		
	}

}
